home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
g_quake
/
ffield.zip
/
UNION.QC
< prev
next >
Wrap
Text File
|
1996-10-28
|
5KB
|
131 lines
// Declare procedures that are defined in other .qc files...
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
float ()crandom;
/*
=======================================
UnionCycleForceField
=======================================
This procedure cycles the force field on and off
*/
void(entity PlayerFFCycle) UnionCycleForceField =
{
if (PlayerFFCycle.Union_ForceField_On == TRUE)
// If the FF is on...
{
// Tell the player, turn of the FF and the glow
sprint(PlayerFFCycle, "Force Field Deactivated...\n");
sound(PlayerFFCycle,CHAN_AUTO,"sound/FF/FF_Off.wav",1,ATTN_NORM);
PlayerFFCycle.Union_ForceField_On = FALSE;
PlayerFFCycle.effects = 0;
}
else
// If the FF is off
{
if (PlayerFFCycle.Union_FF_HasItem == TRUE)
// Make sure that player has it
{
if (PlayerFFCycle.ammo_cells < 1)
// If player doesn't have cells
{
// Tell the player
sprint(PlayerFFCycle, "Cannot activate. No cells...\n");
// Buzz noise?
}
else
// Player has cells so turn on the FF
{
// Tell the player, turn on the FF and the effect.
sprint(PlayerFFCycle, "Force Field Activated...\n");
sound(PlayerFFCycle,CHAN_AUTO,"sound/FF/FF_On.wav",1,ATTN_NORM);
PlayerFFCycle.Union_ForceField_On = TRUE;
PlayerFFCycle.effects = EF_DIMLIGHT;
}
}
else
// Player doesn't have it
{
sprint(PlayerFFCycle, "You don't have the Force Field\n");
}
}
};
/*
=======================================
UnionFFRot
=======================================
This procedure slowly drains cells from the player
and other things that need to be checked periodically.
*/
void(entity PlayerFFRot) UnionFFRot =
{
if (PlayerFFRot.Union_ForceField_On)
{
if (PlayerFFRot.waterlevel > 1)
// When in water, the FF shorts out
// and damages the player
{
UnionCycleForceField(PlayerFFRot);
T_Damage(PlayerFFRot, PlayerFFRot, PlayerFFRot, PlayerFFRot.ammo_cells);
PlayerFFRot.ammo_cells = 0;
stuffcmd (PlayerFFRot, "bf\n");
sound(PlayerFFRot,CHAN_AUTO,"sound/FF/FF_Water.wav",1,ATTN_NORM);
return;
}
if (PlayerFFRot.UnionForceFieldRotTime <= time)
// Draing cells from the player to maintain the field.
{
PlayerFFRot.ammo_cells = PlayerFFRot.ammo_cells - 1;
// If the current weapon is the lightning gun, need
// to change the current ammo to keep it accurate
if (PlayerFFRot.weapon == IT_LIGHTNING)
PlayerFFRot.currentammo = PlayerFFRot.currentammo - 1;
// Update variable for next rot time
PlayerFFRot.UnionForceFieldRotTime = time + 1;
if (PlayerFFRot.ammo_cells < 1)
UnionCycleForceField(PlayerFFRot);
}
}
};
// This function is called from T_damage. It reduces the amount of
// damage a player takes by using 1 cell per 5 damage. It returns
// any leftover damage to T_damage for normal damage resolution.
float(entity UnionTarget, float UnionDamage) UnionFFTakeDamage =
{
if (UnionTarget.ammo_cells < 1)
// No cells left for force field so turn it off and return any
// damage that's letf.
{
UnionTarget.Union_ForceField_On = FALSE;
UnionTarget.effects = 0;
sprint(UnionTarget, "Force Field Depleated!!!\n");
return UnionDamage;
}
if (UnionDamage < 1)
// No damage left
return 0;
if (UnionDamage > 118)
// If the force field takes more than 100 damage in a single hit,
// it overloads and player looses item.
{
UnionTarget.Union_ForceField_On = FALSE;
UnionTarget.Union_FF_HasItem = FALSE;
UnionTarget.ammo_cells = 0;
UnionTarget.effects = 0;
sprint(UnionTarget, "Force Field Overloaded!!!\n");
stuffcmd (UnionTarget, "bf\n");
sound(UnionTarget,CHAN_AUTO,"sound/FF/FF_water.wav",1,ATTN_NORM);
return UnionDamage;
}
// Player still has cells and some damage that's not resolved.
// Take away a cell, remove 5 damage points, and recheck
UnionTarget.ammo_cells = UnionTarget.ammo_cells - 1;
UnionDamage = UnionDamage - 5;
return UnionFFTakeDamage (UnionTarget, UnionDamage);
};